package userrouter

import (
	"github.com/gin-gonic/gin"
	"go-web-admin/app/user/dao"
	"go-web-admin/app/user/handler"
	"go-web-admin/app/user/service"
	"go-web-admin/mysql"
)

func UserRouter(router *gin.Engine) {

	userDao := userdao.NewUserDao(mysql.DB)
	userService := userservice.NewUserService(userDao)
	userHandler := userhandler.NewUserHandler(userService)

	user := router.Group("/user")
	{
		user.GET("/:id", userHandler.FindById)

		user.POST("/register", userHandler.Register)

		user.POST("/login", userHandler.Login)
	}
}
